
/**
 *
 *
 *      opendu  Copyright (C) 2011  YouniS Ben Salah
 *
 *
 *      This file is part of opendu.
 *
 *      opendu is free software: you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation, either version 3 of the License, or
 *      (at your option) any later version.
 *
 *      opendu is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with opendu.  If not, see <http://www.gnu.org/licenses/>.
 *
 *
 *
 *      Program                 ::      opendu
 *      Version                 ::      1.02, beta
 *      Date                    ::      July, August, September, October, November, 2011
 *
 *      Author                  ::      YouniS Ben Salah
 *      E-Mail                  ::      YouniS.BenSalah02@yahoo.de
 *      Website                 ::      http://myhttp.funpic.de
 *
 *      Module                  ::      Game
 *      Header File             ::      ygame.h
 *      Revision                ::      {}
 *
 *
 */




#ifndef YGAME_H_INCLUDED
#define YGAME_H_INCLUDED



/*
 *
 *
 *  Structure               ::      Game
 *  Constructor             ::      initGame()
 *  Destructor              ::      dieinafireGame()
 *
 *  {
 *      + Word : string
 *          The word entered by player 1.
 *
 *      + End_of_game : integer
 *          Indicates the current state of the game.
 *          0, "not yet ended"
 *          1, "player 1 won the game"
 *          2, "player 2 won the game"
 *
 *      + List_of_used_letters : string
 *          A list containing the letters entered by player 2 in UPPERCASE.
 *
 *      + Hidden_word : string
 *          The string printed out to player 2 (dashes "-" in place of the letters not yet guessed).
 *
 *      + Number_of_lifes : integer
 *          Holds the number of remaining lifes.
 *
 *      + Letter : character
 *          Contains the last letter entered by player 2.
 *
 *      + Name_player_1, Name_player_2 : string
 *          Contain the names of the two players.
 *  }
 *
 *
 */

typedef struct Game Game;

struct Game {
    int Number_of_lifes;
    int End_of_game;
    char *List_of_used_letters;
    char *Hidden_word;
    char *Word;
    char Letter;
    char *Name_player_1, *Name_player_2;
};



int initGame( Game *Imagame );
void dieinafireGame( Game *Imagame );
int play( int mode );
void endGame( Game *Imagame );
void readNames( Game *Imagame );
void readLetter( Game *Imagame );
char askAgain(void);
void refreshEnd_of_game( Game *Imagame );
void refreshHidden_word( Game *Imagame );
void readWord( Game *game );
int letterAlreadyUsed( Game *Imagame );



#endif




